

function getParameter(name){
	//alert(name);
	name = name.replace(/[\[]/,"\\\[").replace(/[\]]/,"\\\]");  
	var regexS = "[\\?&]"+name+"=([^&#]*)";  
	var regex = new RegExp( regexS );  
	var results = regex.exec( window.location.href ); 
	
	if( results == null ){
		return "";
	}
	else{
		return results[1];
	}
}

function checkNetwork(level){
	
	if(!level || level == null || level == ""){
		level = "./";
	}
	
  	var url = "http://www.xeliom.com/TD/dummy.php"

 	$.mobile.loadingMessage = "Checking...";
 	$.mobile.loading('show');
	
 	$.getJSON(url).done(function(data) {
 	 	$.mobile.loading('hide');
		return true;
	}).fail(function(jqxhr, textStatus, error) {
	    //alert("No hay conexion a internet: " + textStatus + ", " + error);
	    alert("No hay conexion a internet.");
	    window.location.href = level + 'main.html';
	 	$.mobile.loading('hide');
		return false;
	});

 	$.mobile.loading('hide');

	return false;
}